
package datos;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class OperacionesBase {
    DatabaseManager db = new DatabaseManager();
    
	public boolean ingreso (String query) throws SQLException{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		boolean resultado=stmt.execute(query);
		var.commit();
		return resultado;
	}
	public void ingresoUs (String query) throws SQLException{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		boolean resultado=stmt.execute(query);
		var.commit();
	}
	 
	public ResultSet seleccion (String query) throws SQLException{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		ResultSet resultado=stmt.executeQuery(query);
		return resultado;
	}
	 public int modificacioneliminacion (String query) throws SQLException{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		int resultado=stmt.executeUpdate(query);//modificaciones y elim actualizar
                var.commit();
		return resultado;
	}
	 
	public void cerrarConexion() throws SQLException{
		db.getConnection().close();
	}

        public ResultSet callProcedure (CallableStatement stmt) throws SQLException{		
                stmt.execute();
		ResultSet resultado=(ResultSet)stmt.getObject(1);
		return resultado;
	}  
}